<!--
 * @Author: your name
 * @Date: 2019-11-07 15:40:52
 * @LastEditTime: 2019-11-29 14:40:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \test.classc.cn\app\bancard\view\device\class_info.html
 -->
<!DOCTYPE html>
<html>
	{include file="public1/_header" /}
	<body>
		<style>
			.dtree{
				height: 500px;
			}
		</style>
		<ul id="demoTree" class="dtree" data-id="0"></ul>
	</body>
	<script type="text/javascript">
		$(function() {
			layui.extend({
				dtree: 'dtree/dtree'
			}).use(['form', 'upload', 'dtree', 'laydate', 'tree', 'util'], function() {
				var form = layui.form;
				var $ = layui.jquery;
				var laydate = layui.laydate;
				var tree = layui.tree;
				var util = layui.util;
				var dtree = layui.dtree;

				
				// 初始化树
				var DemoTree = dtree.render({
					elem: "#demoTree",
					data: {$getClass}
				});
				
				dtree.on("node('demoTree')" ,function(obj){
					var index = parent.layer.getFrameIndex(window.name);
					var lfc = top.layerFrameConfig;
					var device_ids =  lfc.iframeB.device_ids;
					var device_key =  lfc.iframeB.device_key;
					var info =  lfc.iframeB.info;
					var data = obj.param;
					data.device_ids = device_ids;
					data.device_key = device_key;
					 $.post("{:url('class_info')}", data, function(res) {
					 	if (res.code == 0) {
					 		layer.msg('设置成功', {
					 			icon: 1,
					 			time: 300
					 		}, function() {
					 			parent.layer.close(index); //再执行关闭
					 			info.reload()
					 		});

					 	} else {
					 		layer.msg(res.msg)
					 	}
					 })
				});
		
			});
		
		
		})
	</script>
</html>
